import { Ref, ref, WatchStopHandle } from "vue";

export class appraisalList {
  public TaskNo: string;
  public TaskName: string;
  public TaskType: number;
  public SelectStatus: boolean;
  constructor(
    taskNo: string = "",
    taskName: string = "",
    taskType: number = 0,
    selectStatus: boolean = false
  ) {
    this.TaskNo = taskNo;
    this.TaskName = taskName;
    this.TaskType = taskType;
    this.SelectStatus = selectStatus;
  }
}

/**
 * 考核设置
 */
export default class AppraisalData {
  private static instance: AppraisalData = new AppraisalData();
  /**
   * 考核设置
   */
  public static get Default(): AppraisalData {
    return this.instance;
  }

  constructor() {
    window.addEventListener("unload", this.Dispose.bind(this));
  }

  Dispose() {
    window.removeEventListener("unload", this.Dispose);

    for (const watchStopHandle of this.watchStopHandles) {
      watchStopHandle();
    }
    // this.watchStopHandles.clear();
  }
  //菜单数据
  public AppraisalDataList: Ref<Array<any>> = ref([]);
  //视角列表
  public ViewpointList: Ref<Array<any>> = ref([]);
  //标定工单ID
  public WorkOrderId: Ref<number> = ref(0);
  // 视角点
  public currentPoint: Ref<string> = ref("0");

  private watchStopHandles: Array<WatchStopHandle> = [];

  public async Awake(): Promise<void> {}

  public async Destroy(): Promise<void> {}
}
